home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 97 / CD-ROM 97 / CD-ROM 97.iso / jogos / spherical / Code / Game / menu_misc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-14  |  30.5 KB  |  821 lines

  1.  
  2. // Copyright (C) 2002 by Luigi Pino.  All Rights Reserved.
  3.  
  4. /***************************************************************************/
  5.  
  6. #include "../library/neurosis.h"
  7. #include "draw.h"
  8. #include "file_io.h"
  9. #include "hiscore.h"
  10. #include "initialize.h"
  11. #include "main.h"
  12. #include "menu_misc.h"
  13. #include "paddle.h"
  14. #include "sphere.h"
  15. #include "update.h"
  16.  
  17. /***************************************************************************/
  18.  
  19. float                                                blink = 0.0f;
  20. float                                                menu_rotate = 0.0f;
  21. int                                                    old_screen_width;
  22.  
  23. extern High_Score_Struct        high_score_sphere;
  24. extern High_Score_Struct        high_score_time;
  25. extern Light_Values_Struct    light_values;
  26. extern Main_Menu_Class            menu;
  27. extern Paddle_Struct                paddle_object[];
  28. extern Sub_Menu_Class                menu_main;
  29. extern Sub_Menu_Class                menu_options;
  30. extern Sub_Menu_Class                menu_control;
  31. extern Sub_Menu_Class                menu_high_scores;
  32. extern Sub_Menu_Class                game_paused;
  33. extern Sub_Menu_Class                game_scores;
  34. extern Timing_Class                    timing;
  35. extern Values_Struct                values;
  36. extern Window_Class                    window;
  37.  
  38. extern bool                                    connected[];
  39. extern char                                    high_score_name[];
  40.  
  41. /***************************************************************************/
  42.  
  43. void Initialize_Menu()
  44.  
  45. {
  46.     menu.Set_Current(&menu_main);
  47.  
  48.     // Main options
  49.     menu_main.Rename_Option(0, "GAME OPTIONS\0");
  50.     menu_main.Add_Option("CONTROL OPTIONS\0");
  51.     menu_main.Add_Option("PLAY TIMED GAME\0");
  52.     menu_main.Add_Option("PLAY COUNTDOWN GAME\0");
  53.     menu_main.Add_Option("PLAY HIGH SCORE GAME\0");
  54.     menu_main.Add_Option("SHOW HIGH SCORES\0");
  55.     menu_main.Add_Option("QUIT\0");
  56.  
  57.     // Game options
  58.     menu_options.Rename_Option(0, "SOUND:\0");
  59.     menu_options.Add_Option("RESOLUTION:\0");
  60.     menu_options.Add_Option("TIMED:\0");
  61.     menu_options.Add_Option("COUNTDOWN:\0");
  62.     menu_options.Add_Option("RETURN\0");
  63.  
  64.     // Sound choices
  65.     menu_options.Rename_Choice(0, 0, "ON\0");
  66.     menu_options.Add_Choice(0, "OFF\0");
  67.  
  68.     // Resolution choices
  69.     menu_options.Rename_Choice(1, 0, "640 X 480\0");
  70.     menu_options.Add_Choice(1, "800 X 600\0");
  71.     menu_options.Add_Choice(1, "1024 X 768\0");
  72.  
  73.     // Timed choices
  74.     menu_options.Rename_Choice(2, 0, "5 MINUTES\0");
  75.     menu_options.Add_Choice(2, "10 MINUTES\0");
  76.     menu_options.Add_Choice(2, "15 MINUTES\0");
  77.  
  78.     // Countdown choices
  79.     menu_options.Rename_Choice(3, 0, "300 POINTS\0");
  80.     menu_options.Add_Choice(3, "600 POINTS\0");
  81.     menu_options.Add_Choice(3, "900 POINTS\0");
  82.  
  83.     // Control options
  84.     menu_control.Rename_Option(0, "TOP PLAYER:\0");
  85.     menu_control.Add_Option("BOTTOM PLAYER:\0");
  86.     menu_control.Add_Option("LEFT PLAYER:\0");
  87.     menu_control.Add_Option("RIGHT PLAYER:\0");
  88.     menu_control.Add_Option("HIGH SCORE:\0");
  89.     menu_control.Add_Option("RETURN\0");
  90.  
  91.     // Top player
  92.     menu_control.Rename_Choice(0, 0, "KEYBOARD 1\0");
  93.     menu_control.Add_Choice(0, "KEYBOARD 2\0");
  94.     menu_control.Add_Choice(0, "JOYSTICK 1\0");
  95.     menu_control.Add_Choice(0, "JOYSTICK 2\0");
  96.     menu_control.Add_Choice(0, "JOYSTICK 3\0");
  97.     menu_control.Add_Choice(0, "JOYSTICK 4\0");
  98.     menu_control.Add_Choice(0, "COMPUTER\0");
  99.     menu_control.Add_Choice(0, "NONE\0");
  100.  
  101.     // Left player
  102.     menu_control.Rename_Choice(1, 0, "KEYBOARD 1\0");
  103.     menu_control.Add_Choice(1, "KEYBOARD 2\0");
  104.     menu_control.Add_Choice(1, "JOYSTICK 1\0");
  105.     menu_control.Add_Choice(1, "JOYSTICK 2\0");
  106.     menu_control.Add_Choice(1, "JOYSTICK 3\0");
  107.     menu_control.Add_Choice(1, "JOYSTICK 4\0");
  108.     menu_control.Add_Choice(1, "COMPUTER\0");
  109.     menu_control.Add_Choice(1, "NONE\0");
  110.  
  111.     // Right player
  112.     menu_control.Rename_Choice(2, 0, "KEYBOARD 1\0");
  113.     menu_control.Add_Choice(2, "KEYBOARD 2\0");
  114.     menu_control.Add_Choice(2, "JOYSTICK 1\0");
  115.     menu_control.Add_Choice(2, "JOYSTICK 2\0");
  116.     menu_control.Add_Choice(2, "JOYSTICK 3\0");
  117.     menu_control.Add_Choice(2, "JOYSTICK 4\0");
  118.     menu_control.Add_Choice(2, "COMPUTER\0");
  119.     menu_control.Add_Choice(2, "NONE\0");
  120.  
  121.     // Bottom player
  122.     menu_control.Rename_Choice(3, 0, "KEYBOARD 1\0");
  123.     menu_control.Add_Choice(3, "KEYBOARD 2\0");
  124.     menu_control.Add_Choice(3, "JOYSTICK 1\0");
  125.     menu_control.Add_Choice(3, "JOYSTICK 2\0");
  126.     menu_control.Add_Choice(3, "JOYSTICK 3\0");
  127.     menu_control.Add_Choice(3, "JOYSTICK 4\0");
  128.     menu_control.Add_Choice(3, "COMPUTER\0");
  129.     menu_control.Add_Choice(3, "NONE\0");
  130.  
  131.     // High score player
  132.     menu_control.Rename_Choice(4, 0, "KEYBOARD 1\0");
  133.     menu_control.Add_Choice(4, "KEYBOARD 2\0");
  134.     menu_control.Add_Choice(4, "JOYSTICK 1\0");
  135.     menu_control.Add_Choice(4, "JOYSTICK 2\0");
  136.     menu_control.Add_Choice(4, "JOYSTICK 3\0");
  137.     menu_control.Add_Choice(4, "JOYSTICK 4\0");
  138.  
  139.     for (int x1=Joystick_1;x1<=Joystick_4;x1=x1+1)
  140.         {
  141.             if (connected[x1] == true)
  142.                 {
  143.                     menu_control.Set_Access_Choice(0, x1, true);
  144.                     menu_control.Set_Access_Choice(1, x1, true);
  145.                     menu_control.Set_Access_Choice(2, x1, true);
  146.                     menu_control.Set_Access_Choice(3, x1, true);
  147.                     menu_control.Set_Access_Choice(4, x1, true);
  148.                 }
  149.             else
  150.                 {
  151.                     menu_control.Set_Access_Choice(0, x1, false);
  152.                     menu_control.Set_Access_Choice(1, x1, false);
  153.                     menu_control.Set_Access_Choice(2, x1, false);
  154.                     menu_control.Set_Access_Choice(3, x1, false);
  155.                     menu_control.Set_Access_Choice(4, x1, false);
  156.                 }
  157.         }
  158.  
  159.     // Pause menu
  160.     game_paused.Rename_Option(0, "RETURN TO GAME\0");
  161.     game_paused.Add_Option("QUIT TO MAIN MENU\0");
  162. }
  163.  
  164. /***************************************************************************/
  165.  
  166. void Show_Person()
  167.  
  168. {
  169.     float3    image_base = {320.0f, -240.0f, 0.0f};
  170.     float3    point_up_left = {0.0f, 0.0f, 0.0f};
  171.     float3    point_up_right = {640.0f, 0.0f, 0.0f};
  172.     float3    point_down_right = {640.0f, -480.0f, 0.0f};
  173.     float3    point_down_left = {0.0f, -480.0f, 0.0f};
  174.  
  175.     Rotate_z(&image_base, &point_up_left, menu_rotate);
  176.     Rotate_z(&image_base, &point_up_right, menu_rotate);
  177.     Rotate_z(&image_base, &point_down_right, menu_rotate);
  178.     Rotate_z(&image_base, &point_down_left, menu_rotate);
  179.  
  180.     glEnable(GL_BLEND);
  181.     glBlendFunc(GL_DST_COLOR, GL_ZERO);
  182.  
  183.     Quad_Texture(t_menu_mask_2, point_up_left.x, point_up_left.y, 0.0f, point_up_right.x, point_up_right.y, 0.0f,
  184.         point_down_right.x, point_down_right.y, 0.0f, point_down_left.x, point_down_left.y, 0.0f,
  185.         0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
  186.  
  187.     glBlendFunc(GL_ONE, GL_ONE);
  188.  
  189.     Quad_Texture(t_menu_2, point_up_left.x, point_up_left.y, 0.0f, point_up_right.x, point_up_right.y, 0.0f,
  190.         point_down_right.x, point_down_right.y, 0.0f, point_down_left.x, point_down_left.y, 0.0f,
  191.         0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
  192.  
  193.     glEnable(GL_BLEND);
  194.     glBlendFunc(GL_DST_COLOR, GL_ZERO);
  195.  
  196.     Quad_Texture(t_menu_mask_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
  197.         0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
  198.  
  199.     glBlendFunc(GL_ONE, GL_ONE);
  200.  
  201.     if (blink > 200.0f)
  202.         Quad_Texture(t_menu_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
  203.         1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
  204.     else
  205.         Quad_Texture(t_menu_1, 200.0f, -50.0f, 0.0f, 470.0f, -50.0f, 0.0f, 470.0f, -240.0f, 0.0f, 200.0f, -240.0f, 0.0f,
  206.         0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
  207.  
  208.     glDisable(GL_BLEND);
  209.  
  210.     menu_rotate = menu_rotate + (100.0f * timing.Get_Scale());
  211.     blink = blink + (100.0f * timing.Get_Scale());
  212.  
  213.     if (blink > 220.0f)
  214.         blink = 0.0f;
  215. }
  216.  
  217. /***************************************************************************/
  218.  
  219. void Show_Menu(Sub_Menu_Class *menu, bool show_stuff, bool show_players)
  220.  
  221. {
  222.     float    current_y = 170.0f;
  223.     int        x1;
  224.  
  225.     Show_Person();
  226.  
  227.     // Print out menu items
  228.     for (x1=0;x1<menu->Option_Size();x1=x1+1)
  229.         {
  230.             if (x1 == menu->Get_Current_Option())
  231.                 {
  232.                     window.Font_Char(menu->Get_Option_Info(x1), -280.0f, current_y, 20.0f, R_4, G_4, B_4);
  233.                     window.Font_Char(menu->Get_Choice_Info(x1), -90.0f, current_y, 20.0f, R_4, G_4, B_4);
  234.                 }
  235.             else
  236.                 {
  237.                     window.Font_Char(menu->Get_Option_Info(x1), -280.0f, current_y, 20.0f, R_3, G_3, B_3);
  238.                     window.Font_Char(menu->Get_Choice_Info(x1), -90.0f, current_y, 20.0f, R_3, G_3, B_3);
  239.                 }
  240.  
  241.             current_y = current_y - 40.0f;
  242.         }
  243.             
  244.     if (show_players == true)
  245.         {
  246.             window.Font_Char("NUMBER OF PLAYERS:", -220.0f, 220.0f, 10.0f, R_3, G_3, B_3);
  247.             window.Font_Int(values.player_number, -100.0f, 220.0f, 10.0f, R_3, G_3, B_3);
  248.         }
  249.  
  250.     if (show_stuff == true)
  251.         {
  252.             if (values.game_type == Timed)
  253.                 {
  254.                     if (values.seconds_left > 0.0f)
  255.                         {
  256.                             window.Font_Char("TOP PLAYER SCORE:          LEFT PLAYER SCORE:          TIME LEFT-", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  257.                             window.Font_Char("RIGHT PLAYER SCORE:        BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  258.                             window.Font_Time(false, true, true, false, values.seconds_left, 185.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  259.  
  260.                             if (paddle_object[Up].game_over == false)
  261.                                 window.Font_Int((int)(paddle_object[Up].score), -122.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  262.                             else
  263.                                 window.Font_Char("TOP PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
  264.  
  265.                             if (paddle_object[Left].game_over == false)
  266.                                 window.Font_Int((int)(paddle_object[Left].score), 65.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  267.                             else
  268.                                 window.Font_Char("                           LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
  269.  
  270.                             if (paddle_object[Right].game_over == false)
  271.                                 window.Font_Int((int)(paddle_object[Right].score), -122.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  272.                             else
  273.                                 window.Font_Char("RIGHT PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
  274.  
  275.                             if (paddle_object[Down].game_over == false)
  276.                                 window.Font_Int((int)(paddle_object[Down].score), 65.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  277.                             else
  278.                                 window.Font_Char("                           BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
  279.                         }
  280.                     else
  281.                         {
  282.                             int count = 0;
  283.                             int x1;
  284.  
  285.                             for (x1=Up;x1<=Right;x1=x1+1)
  286.                                 {
  287.                                     if (paddle_object[x1].game_over == false)
  288.                                         count = count + 1;
  289.                                 }
  290.  
  291.                             if (count > 1)
  292.                                 {
  293.                                     window.Font_Char("TOP PLAYER SCORE:          LEFT PLAYER SCORE:          LAST GOAL WINS", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  294.                                     window.Font_Char("RIGHT PLAYER SCORE:        BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  295.                                 }
  296.                         }
  297.                 }
  298.             else if (values.game_type == Countdown)
  299.                 {
  300.                     window.Font_Char("TOP PLAYER SCORE:          LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  301.                     window.Font_Char("RIGHT PLAYER SCORE:        BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  302.  
  303.                     if (paddle_object[Up].game_over == false)
  304.                         window.Font_Int((int)(paddle_object[Up].score), -122.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  305.                     else
  306.                         window.Font_Char("TOP PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
  307.  
  308.                     if (paddle_object[Left].game_over == false)
  309.                         window.Font_Int((int)(paddle_object[Left].score), 65.0f, 210.0f, 10.0f, R_3, G_3, B_3);
  310.                     else
  311.                         window.Font_Char("                           LEFT PLAYER SCORE:", -250.0f, 210.0f, 10.0f, R_2, G_2, B_2);
  312.  
  313.                     if (paddle_object[Right].game_over == false)
  314.                         window.Font_Int((int)(paddle_object[Right].score), -122.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  315.                     else
  316.                         window.Font_Char("RIGHT PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
  317.  
  318.                     if (paddle_object[Down].game_over == false)
  319.                         window.Font_Int((int)(paddle_object[Down].score), 65.0f, 190.0f, 10.0f, R_3, G_3, B_3);
  320.                     else
  321.                         window.Font_Char("                           BOTTOM PLAYER SCORE:", -250.0f, 190.0f, 10.0f, R_2, G_2, B_2);
  322.                 }
  323.             else
  324.                 {
  325.                     window.Font_Char("SECONDS SINCE LAST GOAL:", -100.0f, 220.0f, 10.0f, R_9, G_9, B_9);
  326.                     window.Font_Float(paddle_object[Down].time_lapse, 2, 125.0f, 220.0f, 10.0f, R_9, G_9, B_9);
  327.                     window.Font_Char("MOST TIME WITH NO GOAL THIS GAME:", -100.0f, 205.0f, 10.0f, R_9, G_9, B_9);
  328.                     window.Font_Float(paddle_object[Down].time_lapse_score, 2, 125.0f, 205.0f, 10.0f, R_9, G_9, B_9);
  329.                 }
  330.         }
  331.  
  332.     window.Font_Char("SPHERICAL VENGEANCE", -300.0f, -215.0f, 10.0f, R_4, G_4, B_4);
  333.     window.Font_Char("THE 23RD DIMENSION - LP23.COM", -300.0f, -225.0f, 10.0f, R_4, G_4, B_4);
  334. }
  335.  
  336. /***************************************************************************/
  337.  
  338. void Menu()
  339.  
  340. {
  341.     TCHAR joystick_name[256];
  342.     int        x1;
  343.  
  344.     menu.Update();
  345.  
  346.     if (menu.Get_Current() == &menu_main)
  347.         {
  348.             if (((menu_main.Get_Current_Option() == 6) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
  349.                 {
  350.                     // Exit menu
  351.                     Save_Config_File();
  352.                     values.game_position = Game_Ending;
  353.                     values.fade_amount = 0.0f;
  354.                     window.keys[VK_ESCAPE] = false;
  355.                     window.keys[VK_RETURN] = false;
  356.                     window.Load_Texture(t_menu_1, "Data/menu_3.bmp");
  357.                     window.Load_Texture(t_menu_2, "Data/menu_4.bmp");
  358.                 }
  359.             else if (menu.Enter_Pressed() == true)
  360.                 {
  361.                     if (menu_main.Get_Current_Option() == 0)
  362.                         {
  363.                             old_screen_width = menu_options.Get_Current_Choice(1);
  364.                             menu.Set_Current(&menu_options);
  365.                         }
  366.                     else if (menu_main.Get_Current_Option() == 1)
  367.                         menu.Set_Current(&menu_control);
  368.                     else if (menu_main.Get_Current_Option() == 2)
  369.                         {
  370.                             values.game_position = Game_Play;
  371.                             values.game_type = Timed;
  372.                             values.sphere_number = 3;
  373.                             Save_Config_File();
  374.                             Initialize_Game();
  375.                             light_values.distance_current = light_values.distance_destination = 0.0f;
  376.                             light_values.rotate_current = light_values.rotate_destination = 0.0f;
  377.                             values.seconds_left = 300.0f + (menu_options.Get_Current_Choice(2) * 300.0f);
  378.                         }
  379.                     else if (menu_main.Get_Current_Option() == 3)
  380.                         {
  381.                             values.game_position = Game_Play;
  382.                             values.game_type = Countdown;
  383.                             values.sphere_number = 1;
  384.                             Save_Config_File();
  385.                             Initialize_Game();
  386.                             light_values.distance_current = light_values.distance_destination = 0.0f;
  387.                             light_values.rotate_current = light_values.rotate_destination = 0.0f;
  388.                         }
  389.                     else if (menu_main.Get_Current_Option() == 4)
  390.                         {
  391.                             values.game_position = Game_Play;
  392.                             values.game_type = High_Score;
  393.                             values.sphere_number = 4;
  394.                             Save_Config_File();
  395.                             Initialize_Game();
  396.                             light_values.distance_current = light_values.distance_destination = 150.0f;
  397.                             light_values.rotate_current = light_values.rotate_destination = 270.0f;
  398.                             values.seconds_left = 150.0f;
  399.                         }
  400.                     else if (menu_main.Get_Current_Option() == 5)
  401.                         menu.Set_Current(&menu_high_scores);
  402.                 }
  403.             else
  404.                 {
  405.                     if (menu_main.Get_Current_Option() == 0)
  406.                         {
  407.                             window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
  408.                             window.Font_Char("SOUND / SCREEN / GAME PLAY OPTIONS.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
  409.                             window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
  410.                         }
  411.                     else if (menu_main.Get_Current_Option() == 1)
  412.                         {
  413.                             window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
  414.                             window.Font_Char("CHANGE GAMEPLAY CONTROLS.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
  415.                             window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
  416.                         }
  417.                     else if (menu_main.Get_Current_Option() == 2)
  418.                         {
  419.                             window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
  420.                             window.Font_Char("PLAY UNTIL ONLY ONE PLAYER IS LEFT.", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
  421.                             window.Font_Char("---------------", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
  422.                         }
  423.                     else if (menu_main.Get_Current_Option() == 3)
  424.                         {
  425.                             window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
  426.                             window.Font_Char("THE PERSON WHO LETS IN THE SPHERE GETS", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
  427.                             window.Font_Char("THEIR SCORE VALUE COUNTED DOWN UNTIL", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
  428.                             window.Font_Char("ANOTHER PERSON LETS IN THE SPHERE.", 20.0f, 155.0f, 10.0f, R_5, G_5, B_5);
  429.                             window.Font_Char("LAST PERSON LEFT WINS.", 20.0f, 140.0f, 10.0f, R_5, G_5, B_5);
  430.                             window.Font_Char("---------------", 20.0f, 125.0f, 10.0f, R_5, G_5, B_5);
  431.                         }
  432.                     else if (menu_main.Get_Current_Option() == 4)
  433.                         {
  434.                             window.Font_Char("---------------", 20.0f, 200.0f, 10.0f, R_5, G_5, B_5);
  435.                             window.Font_Char("COMPETE WITH OTHER PEOPLE. TRY TO GET", 20.0f, 185.0f, 10.0f, R_5, G_5, B_5);
  436.                             window.Font_Char("THE LEAST AMOUNT OF SPHERES IN 2.5 MINUTES.", 20.0f, 170.0f, 10.0f, R_5, G_5, B_5);
  437.                             window.Font_Char("ALSO TRY TO GO THE LONGEST AMOUNT OF TIME", 20.0f, 155.0f, 10.0f, R_5, G_5, B_5);
  438.                             window.Font_Char("WITHOUT LETTING A SPHERE IN. THEN E-MAIL", 20.0f, 140.0f, 10.0f, R_5, G_5, B_5);
  439.                             window.Font_Char("MAIL@LP23.COM", 20.0f, 125.0f, 10.0f, R_4, G_4, B_4);
  440.                             window.Font_Char("              AND THE BEST 5 FOR EACH WILL", 20.0f, 125.0f, 10.0f, R_5, G_5, B_5);
  441.                             window.Font_Char("BE POSTED. FOR MORE INFO CHECK README.TXT", 20.0f, 110.0f, 10.0f, R_5, G_5, B_5);
  442.                             window.Font_Char("---------------", 20.0f, 95.0f, 10.0f, R_5, G_5, B_5);
  443.                         }
  444.  
  445.                     Show_Menu(&menu_main, false, true);
  446.                 }
  447.         }
  448.     else if (menu.Get_Current() == &menu_options)
  449.         {
  450.             if (((menu_options.Get_Current_Option() == 4) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
  451.                 {
  452.                     // Exit menu
  453.                     Save_Config_File();
  454.                     menu.Set_Current(&menu_main);
  455.                     menu_options.Set_Current_Option(0);
  456.  
  457.                     if (old_screen_width != menu_options.Get_Current_Choice(1))
  458.                         {
  459.                             if (menu_options.Get_Current_Choice(1) == 0)
  460.                                 {
  461.                                     window.screen_height = 480;
  462.                                     window.screen_width = 640;
  463.                                 }
  464.                             else if (menu_options.Get_Current_Choice(1) == 1)
  465.                                 {
  466.                                     window.screen_height = 600;
  467.                                     window.screen_width = 800;
  468.                                 }
  469.                             else
  470.                                 {
  471.                                     window.screen_height = 768;
  472.                                     window.screen_width = 1024;
  473.                                 }
  474.  
  475.                             window.KillGLWindow();
  476.  
  477.                             if (!window.CreateGLWindow("Spherical Vengeance", window.screen_width, window.screen_height, 16, true))
  478.                                 exit(1);
  479.  
  480.                             Initialize_Textures(true);
  481.                         }
  482.                 }
  483.  
  484.             Show_Menu(&menu_options, false, true);
  485.         }
  486.     else if (menu.Get_Current() == &menu_control)
  487.         {
  488.             float    current_y = 150.0f;
  489.  
  490.             if (((menu_control.Get_Current_Option() == 5) && (menu.Enter_Pressed() == true)) || (menu.Escape_Pressed() == true))
  491.                 {
  492.                     // Exit menu
  493.                     Save_Config_File();
  494.                     menu.Set_Current(&menu_main);
  495.                     menu_control.Set_Current_Option(0);
  496.                 }
  497.  
  498.             for (x1=Up;x1<=Compete;x1=x1+1)
  499.                 {
  500.                     if ((menu_control.Get_Current_Choice(x1) >= Joystick_1) && (menu_control.Get_Current_Choice(x1) <= Joystick_4))
  501.                         {
  502.                             Get_Joystick_Name(menu_control.Get_Current_Choice(x1) - Joystick_1, joystick_name);
  503.  
  504.                             if (joystick_name[0] == 0)
  505.                                 window.Font_Char("Generic", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
  506.                             else
  507.                                 window.Font_Char(joystick_name, -80.0f, current_y, 10.0f, R_5, G_5, B_5);
  508.                         }
  509.                     else if (menu_control.Get_Current_Choice(x1) == Keyboard_1)
  510.                         window.Font_Char("Arrow keys", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
  511.                     else if (menu_control.Get_Current_Choice(x1) == Keyboard_2)
  512.                         window.Font_Char("W, A, S, D", -80.0f, current_y, 10.0f, R_5, G_5, B_5);
  513.  
  514.                     current_y = current_y - 40.0f;
  515.                 }
  516.  
  517.             // Count players
  518.             values.player_number = 0;
  519.  
  520.             for (x1=Up;x1<=Right;x1=x1+1)
  521.                 {
  522.                     if (menu_control.Get_Current_Choice(x1) != No_User)
  523.                         values.player_number = values.player_number + 1;
  524.                 }
  525.  
  526.             // If 2 players, make sure none can change to No_User
  527.             if (values.player_number == 2)
  528.                 {
  529.                     for (x1=Up;x1<=Right;x1=x1+1)
  530.                         menu_control.Set_Access_Choice(x1, No_User, false);
  531.                 }
  532.             else
  533.                 {
  534.                     for (x1=Up;x1<=Right;x1=x1+1)
  535.                         menu_control.Set_Access_Choice(x1, No_User, true);
  536.                 }
  537.  
  538.             Show_Menu(&menu_control, false, true);
  539.         }
  540.     else if (menu.Get_Current() == &menu_high_scores)
  541.         {
  542.             // Clear escape
  543.             menu.Escape_Pressed();
  544.  
  545.             if (menu.Enter_Pressed() == true)
  546.                 {
  547.                     // Exit menu
  548.                     menu.Set_Current(&menu_main);
  549.                 }
  550.             else
  551.                 {
  552.                     Show_High_Scores(false);
  553.                     window.Font_Char("PRESS ENTER TO CONTINUE", -180.0f, -150.0f, 20.0f, R_4, G_4, B_4);
  554.                 }
  555.         }
  556.     else if (menu.Get_Current() == &game_paused)
  557.         {
  558.             // Clear escape
  559.             menu.Escape_Pressed();
  560.  
  561.             if (menu.Enter_Pressed() == true)
  562.                 {
  563.                     if (game_paused.Get_Current_Option() == 0)
  564.                         {
  565.                             // Go back to game
  566.                             values.game_position = Game_Play;
  567.                             game_paused.Set_Current_Option(0);
  568.                         }
  569.                     else
  570.                         {
  571.                             // Exit game
  572.                             menu.Set_Current(&menu_main);
  573.                             game_paused.Set_Current_Option(0);
  574.                         }
  575.                 }
  576.  
  577.             Show_Menu(&game_paused, true, false);
  578.         }
  579.     else if (menu.Get_Current() == &game_scores)
  580.         {
  581.             float    line_length;
  582.  
  583.             // Clear escape
  584.             menu.Escape_Pressed();
  585.  
  586.             if (values.game_type == Timed)
  587.                 {
  588.                     float low_score = 10000.0f;
  589.                     int        low_player = 0;
  590.  
  591.                     for (x1=Up;x1<=Right;x1=x1+1)
  592.                         {
  593.                             if ((paddle_object[x1].game_over == false) && (paddle_object[x1].score < low_score))
  594.                                 {
  595.                                     low_score = paddle_object[x1].score;
  596.                                     low_player = x1;
  597.                                 }
  598.                         }
  599.  
  600.                     if (paddle_object[Up].input.user != No_User)
  601.                         {
  602.                             if (low_player == Up)
  603.                                 {
  604.                                     line_length = window.Font_Char("TOP PLAYER WINS WITH ", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
  605.                                     line_length = window.Font_Int((int)(paddle_object[Up].score), line_length, 105.0f, 15.0f, R_5, G_5, B_5);
  606.                                     window.Font_Char(" AGAINST", line_length, 105.0f, 15.0f, R_5, G_5, B_5);
  607.                                 }
  608.                             else
  609.                                 {
  610.                                     line_length = window.Font_Char("TOP PLAYER GOT ", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
  611.                                     line_length = window.Font_Int((int)(paddle_object[Up].score), line_length, 105.0f, 15.0f, R_8, G_8, B_8);
  612.                                     window.Font_Char(" AGAINST", line_length, 105.0f, 15.0f, R_8, G_8, B_8);
  613.                                 }
  614.                         }
  615.                     else
  616.                         window.Font_Char("NO TOP PLAYER", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
  617.  
  618.                     if (paddle_object[Left].input.user != No_User)
  619.                         {
  620.                             if (low_player == Left)
  621.                                 {
  622.                                     line_length = window.Font_Char("LEFT PLAYER WINS WITH ", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
  623.                                     line_length = window.Font_Int((int)(paddle_object[Left].score), line_length, 80.0f, 15.0f, R_5, G_5, B_5);
  624.                                     window.Font_Char(" AGAINST", line_length, 80.0f, 15.0f, R_5, G_5, B_5);
  625.                                 }
  626.                             else
  627.                                 {
  628.                                     line_length = window.Font_Char("LEFT PLAYER GOT ", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
  629.                                     line_length = window.Font_Int((int)(paddle_object[Left].score), line_length, 80.0f, 15.0f, R_8, G_8, B_8);
  630.                                     window.Font_Char(" AGAINST", line_length, 80.0f, 15.0f, R_8, G_8, B_8);
  631.                                 }
  632.                         }
  633.                     else
  634.                         window.Font_Char("NO LEFT PLAYER", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
  635.  
  636.                     if (paddle_object[Right].input.user != No_User)
  637.                         {
  638.                             if (low_player == Right)
  639.                                 { 
  640.                                     line_length = window.Font_Char("RIGHT PLAYER WINS WITH ", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
  641.                                     line_length = window.Font_Int((int)(paddle_object[Right].score), line_length, 55.0f, 15.0f, R_5, G_5, B_5);
  642.                                     window.Font_Char(" AGAINST", line_length, 55.0f, 15.0f, R_5, G_5, B_5);
  643.                                 }
  644.                             else
  645.                                 {
  646.                                     line_length = window.Font_Char("RIGHT PLAYER GOT ", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
  647.                                     line_length = window.Font_Int((int)(paddle_object[Right].score), line_length, 55.0f, 15.0f, R_8, G_8, B_8);
  648.                                     window.Font_Char(" AGAINST", line_length, 55.0f, 15.0f, R_8, G_8, B_8);
  649.                                 }
  650.                         }
  651.                     else
  652.                         window.Font_Char("NO RIGHT PLAYER", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
  653.  
  654.                     if (paddle_object[Down].input.user != No_User)
  655.                         {
  656.                             if (low_player == Down)
  657.                                 {
  658.                                     line_length = window.Font_Char("BOTTOM PLAYER WINS WITH ", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
  659.                                     line_length = window.Font_Int((int)(paddle_object[Down].score), line_length, 30.0f, 15.0f, R_5, G_5, B_5);
  660.                                     window.Font_Char(" AGAINST", line_length, 30.0f, 15.0f, R_5, G_5, B_5);
  661.                                 }
  662.                             else
  663.                                 {
  664.                                     line_length = window.Font_Char("BOTTOM PLAYER GOT ", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
  665.                                     line_length = window.Font_Int((int)(paddle_object[Down].score), line_length, 30.0f, 15.0f, R_8, G_8, B_8);
  666.                                     window.Font_Char(" AGAINST", line_length, 30.0f, 15.0f, R_8, G_8, B_8);
  667.                                 }
  668.                         }
  669.                     else
  670.                         window.Font_Char("NO BOTTOM PLAYER", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
  671.  
  672.                     window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -15.0f, 20.0f, R_4, G_4, B_4);
  673.                 }
  674.             else if (values.game_type == Countdown)
  675.                 {
  676.                     if (paddle_object[Up].input.user != No_User)
  677.                         {
  678.                             if (paddle_object[Up].score > 0.0f)
  679.                                 line_length = window.Font_Char("TOP PLAYER WINS", -280.0f, 105.0f, 15.0f, R_8, G_8, B_8);
  680.                             else
  681.                                 {
  682.                                     line_length = window.Font_Char("TOP PLAYER LASTED ", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
  683.                                     line_length = window.Font_Int((int)(paddle_object[Up].time_lapse), line_length, 105.0f, 15.0f, R_5, G_5, B_5);
  684.                                     window.Font_Char(" SECONDS", line_length, 105.0f, 15.0f, R_5, G_5, B_5);
  685.                                 }
  686.                         }
  687.                     else
  688.                             window.Font_Char("NO TOP PLAYER", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
  689.  
  690.                     if (paddle_object[Left].input.user != No_User)
  691.                         {
  692.                             if (paddle_object[Left].score > 0.0f)
  693.                                 line_length = window.Font_Char("LEFT PLAYER WINS", -280.0f, 80.0f, 15.0f, R_8, G_8, B_8);
  694.                             else
  695.                                 {
  696.                                     line_length = window.Font_Char("LEFT PLAYER LASTED ", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
  697.                                     line_length = window.Font_Int((int)(paddle_object[Left].time_lapse), line_length, 80.0f, 15.0f, R_5, G_5, B_5);
  698.                                     window.Font_Char(" SECONDS", line_length, 80.0f, 15.0f, R_5, G_5, B_5);
  699.                                 }
  700.                         }
  701.                     else
  702.                         window.Font_Char("NO LEFT PLAYER", -280.0f, 80.0f, 15.0f, R_5, G_5, B_5);
  703.  
  704.                     if (paddle_object[Right].input.user != No_User)
  705.                         {
  706.                             if (paddle_object[Right].score > 0.0f)
  707.                                 line_length = window.Font_Char("RIGHT PLAYER WINS", -280.0f, 55.0f, 15.0f, R_8, G_8, B_8);
  708.                             else
  709.                                 {
  710.                                     line_length = window.Font_Char("RIGHT PLAYER LASTED ", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
  711.                                     line_length = window.Font_Int((int)(paddle_object[Right].time_lapse), line_length, 55.0f, 15.0f, R_5, G_5, B_5);
  712.                                     window.Font_Char(" SECONDS", line_length, 55.0f, 15.0f, R_5, G_5, B_5);
  713.                                 }
  714.                         }
  715.                     else
  716.                         window.Font_Char("NO RIGHT PLAYER", -280.0f, 55.0f, 15.0f, R_5, G_5, B_5);
  717.  
  718.                     if (paddle_object[Down].input.user != No_User)
  719.                         {
  720.                             if (paddle_object[Down].score > 0.0f)
  721.                                 line_length = window.Font_Char("BOTTOM PLAYER WINS", -280.0f, 30.0f, 15.0f, R_8, G_8, B_8);
  722.                             else
  723.                                 {
  724.                                     line_length = window.Font_Char("BOTTOM PLAYER LASTED ", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
  725.                                     line_length = window.Font_Int((int)(paddle_object[Down].time_lapse), line_length, 30.0f, 15.0f, R_5, G_5, B_5);
  726.                                     window.Font_Char(" SECONDS", line_length, 30.0f, 15.0f, R_5, G_5, B_5);
  727.                                 }
  728.                         }
  729.                     else
  730.                         window.Font_Char("NO BOTTOM PLAYER", -280.0f, 30.0f, 15.0f, R_5, G_5, B_5);
  731.  
  732.                     window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -150.0f, 20.0f, R_4, G_4, B_4);
  733.                 }
  734.             else if (values.game_type == High_Score)
  735.                 {
  736.                     High_Score_Struct    copy_sphere;
  737.                     High_Score_Struct    copy_time;
  738.                     int                                length = strlen(high_score_name);
  739.                     int                                x1;
  740.  
  741.                     if (paddle_object[Down].time_lapse > paddle_object[Down].time_lapse_score)
  742.                         paddle_object[Down].time_lapse_score = paddle_object[Down].time_lapse;
  743.  
  744.                     paddle_object[Compete].time_lapse_score = paddle_object[Down].time_lapse_score;
  745.                     paddle_object[Compete].score = paddle_object[Down].score;
  746.  
  747.                     window.Font_Char("MOST SECONDS BETWEEN GOALS:", -280.0f, 130.0f, 15.0f, R_8, G_8, B_8);
  748.                     window.Font_Float(paddle_object[Compete].time_lapse_score, 2, 5.0f, 130.0f, 15.0f, R_8, G_8, B_8);
  749.                     window.Font_Char("AMOUNT OF SPHERES LET IN:", -280.0f, 105.0f, 15.0f, R_5, G_5, B_5);
  750.                     window.Font_Int((int)(paddle_object[Compete].score), 5.0f, 105.0f, 15.0f, R_5, G_5, B_5);
  751.                     window.Font_Char("PRESS ENTER TO CONTINUE", -200.0f, -150.0f, 20.0f, R_4, G_4, B_4);
  752.  
  753.                     if (((paddle_object[Compete].score < high_score_sphere.spheres[4]) || (paddle_object[Compete].time_lapse_score > high_score_time.time[4]))
  754.                             || ((paddle_object[Compete].score == high_score_sphere.spheres[4]) && (paddle_object[Compete].time_lapse_score > high_score_sphere.time[4]))
  755.                             || ((paddle_object[Compete].time_lapse_score == high_score_time.time[4]) && (paddle_object[Compete].score < high_score_time.spheres[4])))
  756.                         {
  757.                             window.Font_Char("NAME: ", -280.0f, 30.0f, 15.0f, R_1, G_1, B_1);
  758.                             window.Font_Char(high_score_name, -225.0f, 30.0f, 15.0f, R_1, G_1, B_1);
  759.                             window.Font_Char("YOU GOT INTO THE TOP 5", -280.0f, 55.0f, 20.0f, R_1, G_1, B_1);
  760.  
  761.                             if (window.keys[VK_BACK] == true)
  762.                                 {
  763.                                     high_score_name[length - 1] = NULL;
  764.                                     window.keys[VK_BACK] = false;
  765.                                 }
  766.  
  767.                             if (length < 14)
  768.                                 {
  769.                                     for (x1='0';x1<='9';x1=x1+1)
  770.                                         {
  771.                                             if (window.keys[x1] == true)
  772.                                                 {
  773.                                                     high_score_name[length] = (char)(x1);
  774.                                                     window.keys[x1] = false;
  775.                                                 }
  776.                                         }
  777.  
  778.                                     for (x1='A';x1<='Z';x1=x1+1)
  779.                                         {
  780.                                             if (window.keys[x1] == true)
  781.                                                 {
  782.                                                     high_score_name[length] = (char)(x1);
  783.                                                     window.keys[x1] = false;
  784.                                                 }
  785.                                         }
  786.                                 }
  787.  
  788.                             high_score_name[15] = '\0';
  789.                         }
  790.                     else
  791.                         window.Font_Char("YOU DID NOT GET INTO THE TOP 5", -280.0f, 55.0f, 20.0f, R_1, G_1, B_1);
  792.  
  793.                     copy_sphere = high_score_sphere;
  794.                     copy_time = high_score_time;
  795.  
  796.                     Sort_High_Score_Sphere();
  797.                     Sort_High_Score_Time();
  798.                     Show_High_Scores(true);
  799.  
  800.                     high_score_sphere = copy_sphere;
  801.                     high_score_time = copy_time;
  802.  
  803.                     if (menu.Enter_Pressed() == true)
  804.                         {
  805.                             Sort_High_Score_Sphere();
  806.                             Sort_High_Score_Time();
  807.                             Save_High_Score_Verification();
  808.                             Save_Config_File();
  809.                             menu.Set_Current(&menu_main);
  810.                         }
  811.                 }
  812.  
  813.             if (menu.Enter_Pressed() == true)
  814.                 menu.Set_Current(&menu_main);
  815.         }
  816.  
  817.     // Clear enter
  818.     menu.Enter_Pressed();
  819. }
  820.  
  821. /***************************************************************************/